package com.hontech.bv.model.ice

import com.hontech.bv.conn.serial.Uint16
import com.hontech.bv.conn.serial.Uint8

class Status {

    val appVersion = Uint16()
    val sw = Uint8()
    val speed = Uint16()
    val envTemp = Uint8()
    val evapTemp = Uint8()
    val ctrl = Uint8()
    val drawState = Uint8()
    val makeState = Uint8()

    fun switchValue() = Sw(sw.value)
    fun ctrlValue() = Ctrl(ctrl.value)

    fun drawStateString(): String {
        return when (drawState.value) {
            0 -> "空闲"
            1 -> "抽水"
            2 -> "停止"
            3 -> "打开水泵"
            4 -> "超时"
            else -> "未知"
        }
    }

    fun makeStateString(): String {
        return when (makeState.value) {
            0 -> "空闲"
            1 -> "启动搅拌"
            2 -> "制冰"
            3 -> "搅拌结束"
            4 -> "停止"
            5 -> "超时"
            6 -> "异常"
            7 -> "故障"
            else -> "未知"
        }
    }
}
